package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.config.type.CreateConfigTypeBo;
import com.zhuss.bean.bo.core.config.type.DecrConfigTypeSortBo;
import com.zhuss.bean.bo.core.config.type.DeleteConfigTypeBo;
import com.zhuss.bean.bo.core.config.type.IncrConfigTypeSortBo;
import com.zhuss.bean.bo.core.config.type.UpdateConfigTypeBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.core.config.ConfigTypeOperateServiceExt;
import com.zhuss.exception.OceanException;


/**
 * 配置类型操作 controller
 * @Author zhushanshuo
   @Date 2020-02-20 11:58
 *
 */
  
 
@RestController
@RequestMapping("/configType")
public class ConfigTypeOperateController extends BaseController {
	
	@Autowired
	@Qualifier("configTypeOperateService")
	private OperateService<Void, Object> configTypeOperateService;
	
	@Autowired
	@Qualifier("configTypeOperateServiceExt")
	private ConfigTypeOperateServiceExt configTypeOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateConfigTypeBo bo) throws OceanException {
		
		configTypeOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateConfigTypeBo bo) throws OceanException {
		
		configTypeOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteConfigTypeBo bo) throws OceanException {
		
		configTypeOperateService.delete(bo);
    }
	
	/**
	 * 上移
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/incrSort")
    public void incrSort(@RequestBody IncrConfigTypeSortBo bo) throws OceanException {
		
		configTypeOperateServiceExt.incrSort(bo);
    }
	
	/**
	 * 下移
	 * @param bo
	 * @throws OceanException
	 */
	@ResponseBody
    @PostMapping("/decrSort")
    public void decrSort(@RequestBody DecrConfigTypeSortBo bo) throws OceanException {
		
		configTypeOperateServiceExt.decrSort(bo);
    }

	
}
